package com.qifeng.modules.postInfo.service;

import com.qifeng.common.base.BaseService;
import com.qifeng.modules.postInfo.domain.PostInfo;
import com.qifeng.modules.postInfo.domain.PostInfoVo;
import com.qifeng.modules.postInfo.repository.PostInfoRepository;
import com.qifeng.modules.projectInfo.domain.ProjectInfo;
import com.qifeng.modules.projectInfo.repository.ProjectInfoRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Optional;

/**
 * Created by if on 2017/11/22.
 *
 * @author sunyifu
 */
@Service
@Transactional(readOnly = true)
public class PostInfoService extends BaseService<PostInfo, PostInfoRepository, Long> {

    @Autowired
    private PostInfoRepository repository;

    public List<PostInfo> findByUserId(Long id) {
        return repository.findByUserId(id);
    }

    public List<?> findByState(Long state) {
        List list = null;
        if (state == 1) {
            list = repository.getReviewList();
        }
        if (state == 2) {
            list = repository.getCompleteList();
        }
        return list;
    }
}